//
//  ProductCollectionViewCell.swift
//  HttpStydu
//
//  Created by yongkang on 2017/8/16.
//  Copyright © 2017年 sheng. All rights reserved.
//

import UIKit

class ProductCollectionViewCell: UICollectionViewCell {
    
    
    

    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    
    
    
    var product: Product?{
        
        didSet {
            let url = product!.cover_image_url!
            
            productImageView.sd_setImage(with: URL(string: url), placeholderImage: UIImage(named: "1.png"))
            likeButton.setTitle(" " + String(product!.favorites_count!) + " ", for: .normal)
            titleLabel.text = product!.name
            priceLabel.text = "￥" + String(product!.price!)
        }
    }
    
    
    // 背景图片
    @IBOutlet weak var productImageView:UIImageView!
    // 标题
    @IBOutlet weak var titleLabel: UILabel!
    // 价格
    @IBOutlet weak var priceLabel: UILabel!
    // 喜欢按钮
    @IBOutlet weak var likeButton: UIButton!
    
    
    
}
